module PositionCertificateStandardJsonSerializer
  def self.as_json position_certificate_standard
    position_certificate_standard.to_json(include: [:certificates])
  end

  def self.index_as_json position_certificate_standards
    position_certificate_standards.map { |e| JSON.parse(as_json e) }
  end

  def self.show_as_json position_certificate_standard
    { position_id: position_certificate_standard.position_id, 
      certificate_ids: position_certificate_standard.certificates.map(&:id), 
      requre_certificate_organ: position_certificate_standard.requre_certificate_organ.name}
  end
end